]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
notificationDaemon: Include timestamp in serialized notifications
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 26 Feb 2017 23:15:29 +0000 (00:15 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 27 Feb 2017 19:04:09 +0000 (20:04 +0100)
GNotifications are persistent until dismissed or withdrawn, including
across restarts. As we show the time a notification was received in the
calendar, we need to include that information when serializing the
notification in order to be correct.

https://bugzilla.gnome.org/show_bug.cgi?id=775799

js/ui/notificationDaemon.js

index 623a10fed032c8d6623817c531bb425c88a93440..df1a43dbf50b6b929616c3d9d724df12c4e68d63 100644 (file)
@@ -600,7 +600,8 @@ const GtkNotificationDaemonNotification = new Lang.Class({
               "priority": priority,
               "buttons": buttons,
               "default-action": defaultAction,
-              "default-action-target": defaultActionTarget } = notification;
+              "default-action-target": defaultActionTarget,
+              "timestamp": time } = notification;
 
         if (priority) {
             let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
@@ -623,7 +624,8 @@ const GtkNotificationDaemonNotification = new Lang.Class({
         this._defaultActionTarget = defaultActionTarget;
 
         this.update(title.unpack(), body ? body.unpack() : null,
-                    { gicon: gicon ? Gio.icon_deserialize(gicon) : null });
+                    { gicon: gicon ? Gio.icon_deserialize(gicon) : null,
+                      datetime : time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
     },
 
     _activateAction: function(namespacedActionId, target) {
@@ -864,6 +866,9 @@ const GtkNotificationDaemon = new Lang.Class({
             return;
         }
 
+        let timestamp = GLib.DateTime.new_now_local().to_unix();
+        notification['timestamp'] = new GLib.Variant('x', timestamp);
+
         source.addNotification(notificationId, notification, true);
 
         invocation.return_value(null);